package myschool.test;

import myschool.dao.SubjectDao;
import myschool.entity.Subject;
import myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class QueryPaging {
    public static void main(String[] args) {
        SqlSession session = MybatisUtil.get();
        SubjectDao mapper = session.getMapper(SubjectDao.class);
        List<Subject> list = mapper.paging(3, 10);
        list.forEach(x->{
            System.out.print("课程信息："+x);
            System.out.println("  年级:"+x.getGname());
            //gradedao.get(x.getGradeid())//查询两次
        });
        MybatisUtil.close(session);
    }
}
